package com.example.red_tea_house.moudle.LoginAndRegister.controller;

import android.content.Context;
import android.os.Handler;
import android.os.Message;

import androidx.annotation.NonNull;

import com.example.red_tea_house.MyApplication;
import com.example.red_tea_house.annotation.HandlerType;
import com.example.red_tea_house.entity.LoginBean;
import com.example.red_tea_house.moudle.LoginAndRegister.model.LegalData;
import com.example.red_tea_house.util.ToastUtil;

public class ForgetPasswordController extends GetVertifyController{
    private int reset_success = 1;
    private int reset_fail = 0;

    Context context = MyApplication.getContext();
    LoginBean loginBean=new LoginBean();
    LegalData legalData=new LegalData();

    public void getVertifycode(String phone){
        getIdentifycode(phone);
    }

    public int resetpassword(String phone, String vertifyCode, String password1, String password2) {
        loginBean.setPassword(password1);
        loginBean.setPhone(phone);
        if (legalData.isLegalData(loginBean, password2)) {
            vertifySucess();
            return reset_success;
        }
        return reset_fail;
        }

    @Override
    protected void vertifySucess(){
        /*
         * TODO:向服务器发送重置密码的请求
         * */
        ToastUtil.showToast(context, "重置密码成功");
    }
}

